<?php

include '../DB/dbConnection.php';

$result=array();

if ($_POST){
	
	$query="SELECT * FROM school WHERE email='".$_POST['email']."' AND password='".$_POST['password']."' AND request=1 AND activate=1";
		
	$stmt = $conn->prepare($query);
	$success = $stmt->execute();
	$stmt->bind_result($id, $school, $name, $email, $phone, $state, $city, $password, $request, $activate);

	$count = 0;
	$tmp=array();
	
	while ($stmt->fetch())
	{
		$tmp['id']=$id;
		$tmp['school']=$school;
		$tmp['name']=$name;
		$tmp['email']=$email;
		$tmp['phone']=$phone;
		$tmp['state']=$state;
		$tmp['city']=$city;
		//$tmp['password']=$password;
		$tmp['request']=$request;
		$tmp['activate']=$activate;
		$count++;
	}

	$stmt->close();
	$conn->close();
		
	if($success && $count==1)
	{
		$result['error']='false';
		$result['list']=$tmp;
	}
	else
		$result['error']='true';
}
else
{
	$result['error']='true';
}

echo json_encode($result);


?> 
